<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script language="JavaScript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript">
   var identityId = null;
   var pageNO = null;
   function openIdentityAdd(){
   		var url = "${ctx}/occupation_joinHandleAction.do?method=initIdentityValidateAdd";
		top.windowOpen(url, 'houseChoose', '${key.add}', 500, 650, true, "houseChoose");
   }
   function openIdentityEdit(){
   		if(identityId == null){
			ErrorAlert("${key.tipsByModify}");
			return false;
		}
		else{
			var url = "${ctx}/occupation_joinHandleAction.do?method=checkAllowEditIndentity&id="+identityId;
			new Ajax.Request(url,{method: 'post' ,onSuccess : function(response){
				if(response.responseText == 'false'){
					Alert('存在资料发放、验房、预缴款、钥匙移交记录不允许修改！');
				}else if(response.responseText == "notMatch"){
					Alert("客户信息已修改,请重新进行身份验证!");
				}
				else{
				 var url = "${ctx}/occupation_joinHandleAction.do?method=initIdentityValidateEdit&id="+identityId;
		         top.windowOpen(url, 'aa', '${key.modify}', 500, 650, true, "aa");
				}
			}});
		}

   }
   function showIdentityDelete(){
		if( identityId == null ){
			ErrorAlert('${key.tipsByDelete}');
		}else{
		    var url = "${ctx}/occupation_joinHandleAction.do?method=checkIdentityValidateDelete&id="+identityId;
			new Ajax.Request(url,{method: 'post' ,onSuccess : function(response){
				if(response.responseText == 'false'){
					Alert('存在资料发放、验房、预缴款、钥匙移交记录不允许删除！');
					}
				else{
				 AlarmConfirm('${key.tipsByDeleteConfirm}',"identityMain","deleteIdentity");
				}
			}});

		}
	}
	function deleteIdentity(){
		var url="${ctx}/occupation_joinHandleAction.do?method=deleteIdentityValidate";
		var param = "id="+identityId;
		var myAjax = new Ajax.Request(
	                   url,
	                   {method: 'post', parameters:param , onComplete: showResponseDelete}
	                   );
	}
	function showResponseDelete(transport){
		ajaxSubmitException(transport.responseText);
		if(transport.responseText=="false"){
			FailureAlert('${key.doFalse}');
		}else{
			reloadIdentity();
		}
	}
   function openSendDoc(){
   		var url = "${ctx}/occupation_joinHandleAction.do?method=checkAllowNextOpt&id="+identityId;
		new Ajax.Request(url,{method: 'post' ,onSuccess : function(response){
			if(response.responseText == 'false'){
				Alert('客户信息已修改,不能继续入伙操作！');
			}
			else{
			 var url = "${ctx}/occupation_joinHandleAction.do?method=initSendDoc&id="+identityId;
			top.windowOpen(url, 'dd', '', 550, 700, true, "dd");
			}
		}});
   }
   function openHouseValidate(){
   		var url = "${ctx}/occupation_joinHandleAction.do?method=checkAllowNextOpt&id="+identityId;
		new Ajax.Request(url,{method: 'post' ,onSuccess : function(response){
			if(response.responseText == 'false'){
				Alert('客户信息已修改,不能继续入伙操作！');
			}
			else{
			var url = "${ctx}/occupation_joinHandleAction.do?method=initHouseValidateMain&id="+identityId;
			top.windowOpen(url, 'houseChoose', '${key.add}', 500, 750, true, "houseChoose");
			}
		}});
   }
   function openGoodsTransfer(){
   		var url = "${ctx}/occupation_joinHandleAction.do?method=checkAllowNextOpt&id="+identityId;
		new Ajax.Request(url,{method: 'post' ,onSuccess : function(response){
			if(response.responseText == 'false'){
				Alert('客户信息已修改,不能继续入伙操作！');
			}
			else{
			var url = "${ctx}/occupation_joinHandleAction.do?method=initGoodsTransfer&id="+identityId;
			top.windowOpen(url, 'goodTransfer', '', 580, 670, true, "goodTransfer");
			}
		}});
   }
    function reloadIdentity(pageIndex){
   		identityId = null;
   		reLoadIFrameListWithQuery();
   		if(pageIndex != null){
   			pageNO = pageIndex;
   		}
		$('identityList').src="${ctx}/occupation_joinHandleAction.do?method=identityValidateList&ec_p="+pageNO;
	}
	function reLoadIFrameListWithQuery(){
		window.frames("identityList").freshFrame();
	}
	function setIdentityId(id){
		identityId = id;
	}
</script>
</head>
<body>
	<table width="100%" border="0" cellpadding="0" cellspacing="1">
          <tr>
            <td>
			<div>
			  <table width="100%" border="0" cellpadding="0" cellspacing="0"   class="tab_line">
			    <tr>
			      <td class="bg_toolBar"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			        <tr>
			          <td width="35%">&nbsp;</td>
			          <td width="65%" align="right"><!--------------------------右边图标01----------------------------------->
			                <table width="100%" border="0" cellspacing="0" cellpadding="0">
					        <tr>
					          <td align="right">
							  <table border="0" cellpadding="0" cellspacing="0" id="ico01">
					          <tr>
					          <pms:AuthTag authName="occupation_joinHandleAction.do?method=addIdentityValidate">
								 <td class="toolbarico"><a href="#"  onClick="openIdentityAdd();return false;" onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="新建申请" /></a></td>
					    		</pms:AuthTag>
					    		<pms:AuthTag authName="occupation_joinHandleAction.do?method=editIdentityValidate">
					    		 <td class="toolbarico"><a href="#"  onClick="openIdentityEdit();return false;" onFocus="this.blur()"><img src="${ctx}/images/ico_amend.gif" border="0" align="absbottom" alt="修改申请" /></a></td>
					             </pms:AuthTag>
					             <pms:AuthTag authName="occupation_joinHandleAction.do?method=deleteIdentityValidate">
					             <td class="toolbarico"><a href="#" onClick="showIdentityDelete();return false;" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删 除" width="16" height="16" border="0" align="absbottom" /></a></td>
					             </pms:AuthTag>
					             <td  class="toolbarico">&nbsp;</a></td>
					          </tr>
							  </table>
							  </td>
							 </tr>
					        </table>
			         </td>
			        </tr>
			       </table>
			       </td>
			    </tr>
			    <tr>
			      <td valign="top">
			      	<iframe src="${ctx}/occupation_joinHandleAction.do?method=initIdentityValidateList" name="identityList" id="identityList" width="100%" height="400px" frameborder="0" scrolling="auto"> </iframe>
			      </td>
			    </tr>
			  </table>
			</div>
			</td>
            </tr>
       </table>
</body>
</html>